import requests
import json

def get_page(offset, keyword):
    base_url = 'https://www.toutiao.com/api/search/content/?offset=%s&format=json&keyword=%s'
    headers = {'User-Agent':'Moziall/5.0'}

    url = base_url % (str(offset), keyword)
    try:
        content = requests.get(url=url, headers=headers)
        content.encoding='utf-8'
        if 200 == content.status_code:
            print(json.loads(content.text))
    except Exception as e:
        print(str(e))

if __name__ == '__main__':
    offset = 20
    keyword = '街拍'
    for i in range(3):
        get_page(i*offset, keyword)


